﻿using System;
using System.Collections.Generic;
using Plugins.Class;
using ExtensionsAPI;

namespace Services {
	public class Services : List<ExtensionsAPI.INetworkExtension>, IDisposable {
		public void LoadServices(string Path) {
			this.Clear( );
			Plugins.Plugin Plugins = new Plugins.Plugin( );
			Plugins.InterfaceName = "INetworkPlugin";
			Plugins.Interface = "ExtensionsAPI.INetworkPlugin";
			Plugins.LoadPlugins(Path);
			foreach (AvailablePlugin AP in Plugins.AvailablePlugins) {
				Add((INetworkExtension)AP.Instance);
			}
			Plugins.Dispose( );
		}
		public new void Clear( ) {
			foreach (INetworkExtension item in this) {
				item.Dispose( );
			}
			base.Clear( );
		}
		public void Dispose( ) {
			foreach (INetworkExtension item in this) {
				item.Dispose( );
			}
		}
	}
	/* Typ kontakt i kontakty */
	public class AddedEventArgs : EventArgs {
		public AddedEventArgs(string jid) {
			JID = jid;
		}
		public readonly string JID;
		public readonly bool Block;
		public readonly int To;
	}

	public class RemovedEventArgs : EventArgs {
		public RemovedEventArgs(string jid) {
			JID = jid;
		}
		public readonly string JID;
		public readonly bool Block;
		public readonly int To;
	}
}